#version 130

out vec4 oColor;

uniform sampler2D depthTexture;

smooth in vec4 oPosition;
smooth in vec4 texPosition;

void main(void)
{
	vec4 newTexPosition = texPosition / texPosition.w;
	float depth = texture(depthTexture, newTexPosition.xy).r;
	float dis = newTexPosition.z - depth;
	
	if(dis < 0.05)
		oColor = vec4(0.05, 0.05, 0.05, 0.0);
	else if (dis <0.10)
		oColor = vec4( 0, 0.05 , 0.05, 0);
	else 
		oColor = vec4(0, 0, 0.05, 0);
		
	//oColor = vec4(0, 1, 1, 1);
}
